perm filename SEGSIG.MAC[8,ALS] blob
sn#046198 filedate 1973-06-04 generic text, type T, neo UTF8
00010 TITLE SIG
00020
00030 ENTRY SIG
00040
00045 ;Signature table processing routine.
00050 ;Version with line by line computation and spreading for P tables.
00060 ;Also contains TABLET section. June 12 1972.
00070 ;Has been modified to take in long-long files.**********************
00075 ;Main change is in counters, however corected for some error SIG[sys,als]
00076 ;Max level added in left 3 bits of former SFLAG which goes to 2
00078 ;June 4,1973 All learning has been removed. When needed use SIG.MAC.
00079
00080 EXTERNAL TABLES,HINT,UPCNT
00090 EXTERNAL INDAT,INCNT,FLAG
00100
00110 ; Name Rel. Loc. Usage
00120 OUT=0 ;Most recent table output in leftmost bits
00130 SIGTYP=1 ;3 fields,Table type,No of inputs,Gate sign and level
00140 LEARN=2 ;4 PH numbers if Q table or pointer to feature if P
00150 GATE=3 ;Gating byte pointer
00160 IN1=4 ;Byte pointer to first input
00170 IN2=5 ;Byte pointer to second input
00180 IN3=6 ;Byte pointer to third input
00190 IN4=7 ;Byte pointer to fourth input
00200 IN5=10 ;Byte pointer to fifth input
00210 IN6=11 ;Byte pointer to sixth input
00220 SIGTAB=12 ;Start of actual table
00230
00240 EXTERNAL TABLET,SEGC,TFLAG
00250
00260 ; Name Rel.Loc Usage as referenced in section starting with XXX
00270 OUT= 0 ;AVERAGE LEVEL(3),START(15),MAX.LEVEL(3),LENGTH(15)
00280 SIGTYP= 1 ;SIXBIT name of tablet
00290 ALDATA= 2 ;Unused(1),Level(3),toler(2),excnt(2)
00300 ;SMAX(3),SFLAG(2),exsum(5),segsum(18)
00310 OUT1= 3 ;Next older outputs
00320 IN1= 4 ;Byte pointer to input
00330
00340 ;Index register assignments
00350 ;Regester Usage
00360 Z=0 ; general purpose register
00370 I=1 ;Used to index between tables (incremented by 74)
00380 J=2 ;Used to index within tables
00390 K=3 ;Special purpose indexing and general use when Z not wanted
00400 L=4
00410 M=5 ;Used to hold counter bit
00420 N=6
00430 P=7 ;Used to index INDAT files
00440 Q=10 ;Used to hold mask
00450 R=11 ;Used to hold quantized marker
00460 S=12
00470 T=13 ;Reserved exclusively for the address of the first word in TABLES
00480 F=14
00490 H=15 ;Used to hold HINT word repeated in right 3 6-bit fields
00500 PO=16 ;NO LONGER USED
00510 X=17 ;Used to index in buckets
00520
00530 SIG: 0
00540 MOVEM 17,SAVE+17
00550 MOVE 17,[XWD 0,SAVE]
00560 BLT 17,SAVE+16
00570
00580 TIN1: MOVE Z,@0(16)
00590 MOVE T,TABLES ;Necessary for IN pointers to work
00600 MOVE Z,INDAT
00610 HRRM Z,TIN2
00640 MOVE H,HINT
00650 LSH H,6
00660 ADD H,HINT
00670 LSH H,6
00680 ADD H,HINT
00690 LSH H,6
00700 ADD H,HINT
00710 SETZ P, ;To index input data
00740 MOVE I,TABLES ;To index tables
00750 TIN2: MOVE J,0(P) ;Get INDAT value into index
00752 CAIGE J,0 ;Limit minimum to 0
00754 MOVEI J,0
00756 CAILE J,77 ;Limit maximum to 63
00758 MOVEI J,77
00760 ADD J,I
00770 MOVE K,SIGTAB(J)
00790 MOVE L,OUT(I)
00800 LSHC K,-3 ;Shift out oldest and add newest output
00810 MOVEM L,OUT(I)
01050 TIN6: ADDI I,112 ;To go to the next table
01060 AOS P ;Keep INDAT index in step
01070 SKIPN SIGTYP(I) ;Test table type
01080 JRST TIN2 ;Still more input tables
01090 MOVEM I,ISAV# ;Save start of P-Q region in prep for update
01100 PQ1: SKIPN SIGTYP(I) ;A 0 value NOW means end of tables
01110 JRST XXX ;Go to tablets
01120 LDB K,GATE(I) ;Is this table to be used
01130 LDB L,GPOINT ;Get gating threshold
01140 SUB K,L ;Is level high enough
01141
01142 CAIGE L,10 ;Test for negative gate
01143 JRST .+4
01144 ADDI K,10
01145 JUMPLE K,PQ2
01146 SKIPA
01147
01150 JUMPGE K,PQ2 ; Yes
01160 LDB L,TPOINT ; Find table type
01170 JUMPN L,PQ1A ;Must be a Q table
01180 MOVE L,OUT(I) ;Fix table output for gate off case
01190 LSH L,-3 ;Introuce a 0
01200 MOVEM L,OUT(I) ;Output and go to next table
01210 JRST PP2
01220
01230 PQ1A: MOVE K,OUT(I)
01240 MOVE L,OUT+112(I)
01250 LSHC K,-22
01260 MOVEM L,OUT+112(I)
01270 MOVE L,OUT(I)
01280 LSH L,-22 ;Shift 18 places for Q table
01290 OR L,[700000000000] ;Add the NOT-ANY output for Q table
01300 MOVEM L,OUT(I)
01310 JRST PQ8 ;Go to next table
01320
01330 PQ2: LDB J,IN1(I) ;J used to accumulate index to line
01340 LDB K,IN2(I)
01350 LDB L,NPOINT ;To get number of inputs from SIGDAT
01360 CAILE L,3 ;Is it a 2- or a 3-input type
01370 JRST PQ6 ;NO, it is a 6-input table
01380 CAILE L,2 ;Is it a 2 input table
01390 JRST PQ3 ;No, it has 3 inputs
01400 DPB K,D2N2 ;Deposit as 2nd of 2 inputs
01410 JRST PQX
01420
01430 PQ3: DPB K,D2N3 ;Deposit as 2nd of 3 inputs
01440 LDB K,IN3(I)
01450 DPB K,D3N3 ;Deposit as 3rd of 3
01460 JRST PQX
01470
01480 PQ6: DPB K,D2N6 ;Deposit as 2nd of 6
01490 LDB K,IN3(I)
01500 DPB K,D3N6 ;3 of 6
01510 LDB K,IN4(I)
01520 DPB K,D4N6 ;4 of 6
01530 LDB K,IN5(I)
01540 DPB K,D5N6 ;5 of 6
01550 LDB K,IN6(I)
01560 DPB K,D6N6 ;6 of 6
01570 PQX: ADD J,I ;Add start of table I address to J
01580 LDB K,TPOINT ;Now find whether P or Q table
01590 JUMPN K,QQ1 ;A 1 in this field means Q
01600 MOVE K,SIGTAB(J) ;Get new output
01610 MOVE L,OUT(I)
01620 LSHC K,-3 ;Displace oldest and add newest to left
01630 MOVEM L,OUT(I)
01770 PP2: ADDI I,112
01780 JRST PQ1
01790
01800 QQ1: MOVE K,OUT(I)
01810 MOVE L,OUT+112(I)
01820 LSHC K,-22
01830 MOVEM L,OUT+112(I)
01840 MOVE K,SIGTAB(J) ;Get new output
01850 MOVE L,OUT(I)
01860 LSHC K,-22 ;18-bit fields in output for Q tables
01870 MOVEM L,OUT(I)
02770 PQ8: ADDI I,224 ;Double space for Q table
02780 JRST PQ1 ;Go to next table
02790
02800 XXX: MOVE F,TABLET ;For pointers to words in tablet
02810 MOVEI R,0 ;For zeroing ex values as needed
02820 XXX2: LDB L,LEVPT ;Get level
02830 JUMPE L,FINISH ;0 level reserved for end of table
02840 LDB K,IN1(F)
02850 LDB Z,PAVER ;Used to see if in + state
02860 JUMPE Z,PXX ;We are since OUT has been shifted
02870 MXX: CAMGE K,L ;Is input below threshold
02880 JRST RET ;Yes so we are still marking time
02890 MPX: LDB X,EXSUM ;May be starting a + state so save data
02900 ADD X,K
02902 LDB PO,SMAX ;Compare maximum values
02905 CAMGE PO,K
02906 DPB K,SMAX ;Present value is larger
02910 DPB X,EXSUM ;Save now
02920 LDB J,EXCNT ;Update exception count
02930 ADDI J,1
02940 DPB J,EXCNT
02950 LDB Q,TOLPT ;Now compare with tolerance count
02960 CAMG J,Q
02970 JRST RET ;Not enough exceptions to start + state
02980 MOVE J,OUT(F) ;We are entering + state
02990 MOVE K,OUT1(F)
03000 LSHC J,-44 ;Make room for new data
03010 MOVEM J,OUT(F)
03020 MOVEM K,OUT1(F)
03030 DPB X,SEGSUM ;Transfer exsum to segsum
03040 DPB R,EXSUM ;Zero EXSUM
03050 DPB R,EXCNT ;Also reset excnt
03060 MOVE Z,SEGC ;Save correct segc
03070 SUB Z,Q ;Correct for delayed decision
03080 DPB Z,PPNTA ;Put it into OUT(F)
03090 JRST RET ;Go to next tablet
03100
03110 PXX: CAML K,L ;We must now test level
03120 JRST PPX ;Continuation of + state
03130 LDB X,EXSUM ;May be ending + state but also may not
03140 ADD X,K ;Save temporarily
03150 DPB X,EXSUM
03160 LDB J,EXCNT ;Check on length of exception period
03170 ADDI J,1
03180 DPB J,EXCNT
03190 LDB Q,TOLPT ;Has it reached tolerance limit
03200 CAMG J,Q
03210 JRST RET ;No
03220 MOVE Z,SEGC ;Find end segc
03230 LDB L,PPNTA
03240 SUB Z,L
03250 SUB Z,Q
03260 DPB Z,PCNT ;Save duration count
03270 LDB J,SEGSUM
03280 LSH J,1 ;Prepare to round
03290 IDIV J,Z ;Get average value
03300 ADDI J,1
03310 LSH J,-1 ;Rounding complete
03320 DPB J,PAVER ;Save
03322 LDB Z,SMAX
03324 DPB Z,PMAX ;Save maximum value in OUT
03326 DPB R,SMAX ;and reset SMAX to zero
03330 DPB R,SEGSUM ;Reset to zero
03340 DPB R,EXCNT
03350 DPB R,EXSUM
03352 JUMPLE J,ZERO ;Indicates trouble, the counter acts FF
03360 LDB Z,SFLAG
03370 ADDI Z,1
03380 DPB Z,SFLAG ;Count of states since reset
03390 AOS TFLAG ;Add to count of total state changes
03400 JRST RET
03402 ZERO: ADDI J,1
03404 DPB J,PAVER
03406 JRST RET
03408
03410
03420 PPX: ADDM K,ALDATA(F) ;Continuation of normal + state
03422 LDB Z,SMAX
03424 CAMGE Z,K ;Check if current max
03426 DPB K,SMAX ;SAVE CURRENT VALUE AS SMAX
03430 LDB J,EXCNT ;Have any exceptions occured
03440 JUMPLE J,RET ;If not we are through
03450 LDB X,EXSUM ;Must transfer to segsum
03460 ADDM X,ALDATA(F) ;Right half is segsum remember
03470 DPB R,EXCNT
03480 DPB R,EXSUM ;Reset ex values
03490 RET: ADDI F,5
03500 JRST XXX2 ;Go to next TABLET
03510
03520 PAVER: POINT 3,OUT(F),2 ;Average input during state
03530 PPNTA: POINT 15,OUT(F),17 ;SEGC at start of state
03532 PMAX: POINT 3,OUT(F),20 ;Max level
03540 PCNT: POINT 15,OUT(F),35 ;count of segments during state
03550
03560 LEVPT: POINT 3,ALDATA(F),3 ;Pre-assigned level
03570 TOLPT: POINT 2,ALDATA(F),5 ;Exception tolerance value
03580 EXCNT: POINT 2,ALDATA(F),7 ;Count of exceptions
03582 SMAX: POINT 3,ALDATA(F),10 ;Record of maximum during state
03590 SFLAG: POINT 2,ALDATA(F),12 ;Count of state changes for this TAABLET
03600 EXSUM: POINT 5,ALDATA(F),17 ;Running sum during exception periods
03610 SEGSUM: POINT 18,ALDATA(F),35 ;Running sum during + state
03620
03630 FINISH: MOVE 17,[XWD SAVE,0]
03640 BLT 17,17
03650 JRA 16,1(16)
03660
03670
03680 SAVE: BLOCK 20
03690 SUM: Z
03700
03710 UPDPT: POINT 2,SIGTAB(J),1 ;Space for update record mod 4
03720 NOTPT: POINT 16,SIGTAB(J),17
03730 PH1PT: POINT 9,SIGTAB+112(J),8
03740 PH2PT: POINT 9,SIGTAB+112(J),17
03750 PH3PT: POINT 9,SIGTAB+112(J),26
03760 PH4PT: POINT 9,SIGTAB+112(J),35
03770
03780 OTXPT: POINT 3,SIGTAB(J),35
03790 NTOPT: POINT 3,SIGTAB(J),20
03800 OT1PT: POINT 3,SIGTAB(J),23
03810 OT2PT: POINT 3,SIGTAB(J),26
03820 OT3PT: POINT 3,SIGTAB(J),29
03830 OT4PT: POINT 3,SIGTAB(J),32
03840
03850 D2N2: POINT 3,J,32 ;For depositing second input to A 2-input table
03860 D2N3: POINT 2,J,33 ;For depositing 2ND input to A 3 INPUT TABLE
03870 D3N3: POINT 2,J,31
03880 D2N6: POINT 1,J,34
03890 D3N6: POINT 1,J,33
03900 D4N6: POINT 1,J,32
03910 D5N6: POINT 1,J,31
03920 D6N6: POINT 1,J,30
03930
03940 BPT3: POINT 3,L,2 ;For first 3 bits of L
03950 BPT12: POINT 12,L,11 ;For first 12 bits of L
03960 GPOINT: POINT 4,SIGTYP(I),17 ;For gating threshold from SIGTYP
03970 TPOINT: POINT 1,SIGTYP(I),5 ;For Q indicator bit in SIGTYP
03980 NPOINT: POINT 3,SIGTYP(I),11 ;For number of inputs
03990 GDPNT: POINT 16,SIGTAB(J),31 ;GOOD field for P type tables
04000 BADPNT: POINT 16,SIGTAB(J),15 ;BAD field for P type tables
04010 SPREAD: OCT 0,0,1,1 ;Can be used to spread outputs
04020 OCT 2,2,3,3
04030 OCT 4,4,5,5
04040 OCT 6,6,7,7,7
04050
04060
04070 END